﻿using System;
using AgateLib.InputLib;
using AiAsteriods.Game.Tools;

namespace AiAsteriods.Game.State {
  class MenuState : GameStateAbstract {
    private AgateLib.DisplayLib.FontSurface fontNormal;

    public MenuState(ResourceManager rm, GameStart gs) : base(rm, gs) {
      Console.WriteLine("starting main menu");
    }

    override public void InitState() {
      fontNormal = new AgateLib.DisplayLib.FontSurface("Arial", 15);
    }

    override public void UpdateState(int delta) {
      if (Keyboard.Keys[KeyCode.Enter]) {
        Keyboard.ReleaseKey(KeyCode.Enter);
        gs.ResetGame();
        gs.SwitchStates(1);
      }
    }

    public override void DrawState() {
      base.DrawState();
      string text = "Press Enter To Start";
      fontNormal.DrawText(Global.GameStart.ScreenWidth / 2.0 - fontNormal.StringDisplayWidth(text) / 2.0, Global.GameStart.ScreenHeight / 2.0, text);
    }
  }
}